
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>4.4 参数相关API · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="45-zu-jian-xiang-guan-api.html" />
    
    
    <link rel="prev" href="3ding-shi-qi-xiang-guan-api.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../chapter1.html">
            
                <a href="../chapter1.html">
            
                    
                    第1章 Cyber RT 概述与环境搭建
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../chapter1/11-cyber-rt-jian-jie.html">
            
                <a href="../chapter1/11-cyber-rt-jian-jie.html">
            
                    
                    1.1 Cyber RT 简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../chapter1/12-cyber-rt-an-zhuang.html">
            
                <a href="../chapter1/12-cyber-rt-an-zhuang.html">
            
                    
                    1.2 Cyber RT 安装
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="../chapter1/12-cyber-rt-an-zhuang/121-zhun-bei-gong-zuo.html">
            
                <a href="../chapter1/12-cyber-rt-an-zhuang/121-zhun-bei-gong-zuo.html">
            
                    
                    1.2.1 准备工作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.2" data-path="../chapter1/12-cyber-rt-an-zhuang/122-cyber-rt-an-zhuang.html">
            
                <a href="../chapter1/12-cyber-rt-an-zhuang/122-cyber-rt-an-zhuang.html">
            
                    
                    1.2.2 Cyber RT 安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.3" data-path="../chapter1/12-cyber-rt-an-zhuang/123-ce-shi.html">
            
                <a href="../chapter1/12-cyber-rt-an-zhuang/123-ce-shi.html">
            
                    
                    1.2.3 测试
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../chapter1/14-cyber-rt-ji-cheng-kai-fa-huan-jing-da-jian.html">
            
                <a href="../chapter1/14-cyber-rt-ji-cheng-kai-fa-huan-jing-da-jian.html">
            
                    
                    1.3 Cyber RT 集成开发环境搭建
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.3.1" data-path="../chapter1/14-cyber-rt-ji-cheng-kai-fa-huan-jing-da-jian/131-vscode-xia-zai-yu-an-zhuang.html">
            
                <a href="../chapter1/14-cyber-rt-ji-cheng-kai-fa-huan-jing-da-jian/131-vscode-xia-zai-yu-an-zhuang.html">
            
                    
                    1.3.1 Vscode 下载与安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.2" data-path="../chapter1/14-cyber-rt-ji-cheng-kai-fa-huan-jing-da-jian/132-vscode-cha-jian-de-an-zhuang-yi-ji-shi-yong.html">
            
                <a href="../chapter1/14-cyber-rt-ji-cheng-kai-fa-huan-jing-da-jian/132-vscode-cha-jian-de-an-zhuang-yi-ji-shi-yong.html">
            
                    
                    1.3.2 Vscode 插件的安装以及使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../chapter1/13-cyber-rt-kuai-su-ti-yan.html">
            
                <a href="../chapter1/13-cyber-rt-kuai-su-ti-yan.html">
            
                    
                    1.4 Cyber RT 快速体验
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.4.1" data-path="../chapter1/13-cyber-rt-kuai-su-ti-yan/141-cshi-xian-helloworld.html">
            
                <a href="../chapter1/13-cyber-rt-kuai-su-ti-yan/141-cshi-xian-helloworld.html">
            
                    
                    1.4.1 c++实现HelloWorld
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.2" data-path="../chapter1/13-cyber-rt-kuai-su-ti-yan/142-pythonshi-xian-helloworld.html">
            
                <a href="../chapter1/13-cyber-rt-kuai-su-ti-yan/142-pythonshi-xian-helloworld.html">
            
                    
                    1.4.2 Python实现HelloWorld
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../chapter1/15-zhun-bei-1-bazel.html">
            
                <a href="../chapter1/15-zhun-bei-1-bazel.html">
            
                    
                    1.5 预备知识——bazel
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.5.1" data-path="../chapter1/15-zhun-bei-1-bazel/151-bazel-ji-ben-shi-yong-liu-cheng.html">
            
                <a href="../chapter1/15-zhun-bei-1-bazel/151-bazel-ji-ben-shi-yong-liu-cheng.html">
            
                    
                    1.5.1 Bazel使用之基本流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5.2" data-path="../chapter1/15-zhun-bei-1-bazel/151-bazel.html">
            
                <a href="../chapter1/15-zhun-bei-1-bazel/151-bazel.html">
            
                    
                    1.5.2 Bazel使用之库依赖
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../chapter1/16-ben-zhang-xiao-jie.html">
            
                <a href="../chapter1/16-ben-zhang-xiao-jie.html">
            
                    
                    1.6 预备知识——protobuf
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.6.1" data-path="../chapter1/16-ben-zhang-xiao-jie/161-protoshi-yong-zhi-wen-jian-chuang-jian.html">
            
                <a href="../chapter1/16-ben-zhang-xiao-jie/161-protoshi-yong-zhi-wen-jian-chuang-jian.html">
            
                    
                    1.6.1 proto使用之文件创建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6.2" data-path="../chapter1/16-ben-zhang-xiao-jie/162-protoshi-yong-zhi-du-xie-cao-zuo.html">
            
                <a href="../chapter1/16-ben-zhang-xiao-jie/162-protoshi-yong-zhi-du-xie-cao-zuo.html">
            
                    
                    1.6.2 proto读写之C++实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6.3" data-path="../chapter1/16-ben-zhang-xiao-jie/163-protodu-xie-zhi-python-shi-xian.html">
            
                <a href="../chapter1/16-ben-zhang-xiao-jie/163-protodu-xie-zhi-python-shi-xian.html">
            
                    
                    1.6.3 proto读写之Python实现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../chapter1/17-ben-zhang-xiao-jie.html">
            
                <a href="../chapter1/17-ben-zhang-xiao-jie.html">
            
                    
                    1.7 本章小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi.html">
            
                    
                    第2章 Cyber RT 通信机制
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/21-hua-ti-tong-xin.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/21-hua-ti-tong-xin.html">
            
                    
                    2.1 话题通信
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1.1" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/21-hua-ti-tong-xin/211cshi-xian.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/21-hua-ti-tong-xin/211cshi-xian.html">
            
                    
                    2.1.1C++实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.2" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/21-hua-ti-tong-xin/212-pythonshi-xian.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/21-hua-ti-tong-xin/212-pythonshi-xian.html">
            
                    
                    2.1.2 Python实现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/22-fu-wu-tong-xin.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/22-fu-wu-tong-xin.html">
            
                    
                    2.2 服务通信
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.2.1" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/22-fu-wu-tong-xin/221-cshi-xian.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/22-fu-wu-tong-xin/221-cshi-xian.html">
            
                    
                    2.2.1 C++实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.2" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/22-fu-wu-tong-xin/222-pythonshi-xian.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/22-fu-wu-tong-xin/222-pythonshi-xian.html">
            
                    
                    2.2.2 Python实现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/23-can-shu.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/23-can-shu.html">
            
                    
                    2.3 参数
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.1" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/23-can-shu/231-cshi-xian.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/23-can-shu/231-cshi-xian.html">
            
                    
                    2.3.1 C++实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/23-can-shu/232-pythonshi-xian.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/23-can-shu/232-pythonshi-xian.html">
            
                    
                    2.3.2 Python实现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/24-zu-jian.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/24-zu-jian.html">
            
                    
                    2.4 组件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.4.1" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/24-zu-jian/241-ji-ben-component-yan-shi.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/24-zu-jian/241-ji-ben-component-yan-shi.html">
            
                    
                    2.4.1 通用组件演示(上)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.2" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/24-zu-jian/242-ji-ben-zu-jian-yan-793a28-4e0b29.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/24-zu-jian/242-ji-ben-zu-jian-yan-793a28-4e0b29.html">
            
                    
                    2.4.2 通用组件演示(下)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.3" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/24-zu-jian/242-shi-jian-zu-jian-yan-shi.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/24-zu-jian/242-shi-jian-zu-jian-yan-shi.html">
            
                    
                    2.4.3 定时器组件演示
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/25-ben-zhang-xiao-jie.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/25-ben-zhang-xiao-jie.html">
            
                    
                    2.5 本章小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../di-3-zhang-cyber-rt-kai-fa-gong-ju.html">
            
                <a href="../di-3-zhang-cyber-rt-kai-fa-gong-ju.html">
            
                    
                    第3章 Cyber RT 开发工具
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../di-3-zhang-cyber-rt-kai-fa-gong-ju/32-cyberrecorder.html">
            
                <a href="../di-3-zhang-cyber-rt-kai-fa-gong-ju/32-cyberrecorder.html">
            
                    
                    3.1 cyber record
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1.1" data-path="../di-3-zhang-cyber-rt-kai-fa-gong-ju/32-cyberrecorder/321-c++-shi-xian.html">
            
                <a href="../di-3-zhang-cyber-rt-kai-fa-gong-ju/32-cyberrecorder/321-c++-shi-xian.html">
            
                    
                    3.2.1 C++ 实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.2" data-path="../di-3-zhang-cyber-rt-kai-fa-gong-ju/32-cyberrecorder/332-python-shi-xian.html">
            
                <a href="../di-3-zhang-cyber-rt-kai-fa-gong-ju/32-cyberrecorder/332-python-shi-xian.html">
            
                    
                    3.3.2 Python 实现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/25-chang-yong-ming-ling.html">
            
                <a href="../di-2-zhang-cyber-rt-tong-xin-ji-zhi/25-chang-yong-ming-ling.html">
            
                    
                    3.2 常用命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../di-3-zhang-cyber-rt-kai-fa-gong-ju/33-ben-zhang-xiao-jie.html">
            
                <a href="../di-3-zhang-cyber-rt-kai-fa-gong-ju/33-ben-zhang-xiao-jie.html">
            
                    
                    3.3 本章小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../zi-65993a-chang-yong-api.html">
            
                <a href="../zi-65993a-chang-yong-api.html">
            
                    
                    第4章 Cyber RT 常用API
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="1apiwen-dang.html">
            
                <a href="1apiwen-dang.html">
            
                    
                    4.1 节点相关API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="2shi-jian-xiang-guan-api.html">
            
                <a href="2shi-jian-xiang-guan-api.html">
            
                    
                    4.2 话题相关API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="3ding-shi-qi-xiang-guan-api.html">
            
                <a href="3ding-shi-qi-xiang-guan-api.html">
            
                    
                    4.3 服务相关API
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.4" data-path="44-can-shu-xiang-guan-api.html">
            
                <a href="44-can-shu-xiang-guan-api.html">
            
                    
                    4.4 参数相关API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="45-zu-jian-xiang-guan-api.html">
            
                <a href="45-zu-jian-xiang-guan-api.html">
            
                    
                    4.5 组件相关API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="46-shi-jian-xiang-guan-api.html">
            
                <a href="46-shi-jian-xiang-guan-api.html">
            
                    
                    4.6 时间相关API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="47-ri-zhi-xiang-guan-api.html">
            
                <a href="47-ri-zhi-xiang-guan-api.html">
            
                    
                    4.7 日志相关API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="48-record-xiang-guan-api.html">
            
                <a href="48-record-xiang-guan-api.html">
            
                    
                    4.8 record 相关API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.9" data-path="48-ben-zhang-xiao-jie.html">
            
                <a href="48-ben-zhang-xiao-jie.html">
            
                    
                    4.9 本章小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >4.4 参数相关API</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="44-&#x53C2;&#x6570;&#x76F8;&#x5173;api">4.4 &#x53C2;&#x6570;&#x76F8;&#x5173;API</h2>
<h3 id="c&#x90E8;&#x5206;">C++&#x90E8;&#x5206;</h3>
<p>Parameter Service&#x7528;&#x4E8E;&#x8282;&#x70B9;&#x95F4;&#x5171;&#x4EAB;&#x6570;&#x636E;&#xFF0C;&#x63D0;&#x4F9B;set&#x3001;get&#x3001;list&#x7B49;&#x57FA;&#x672C;&#x64CD;&#x4F5C;&#x3002;&#x53C2;&#x6570;&#x670D;&#x52A1;&#x57FA;&#x4E8E;&#x670D;&#x52A1;&#x5B9E;&#x73B0;&#xFF0C;&#x5305;&#x542B;&#x670D;&#x52A1;&#x548C;&#x5BA2;&#x6237;&#x7AEF;&#xFF0C;&#x88AB;&#x5171;&#x4EAB;&#x7684;&#x6570;&#x636E;&#x5C01;&#x88C5;&#x4E3A; Parameter &#x5BF9;&#x8C61;&#x3002;</p>
<h4 id="1&#x53C2;&#x6570;&#x5BF9;&#x8C61;">1.&#x53C2;&#x6570;&#x5BF9;&#x8C61;</h4>
<p>&#x6784;&#x9020;&#x51FD;&#x6570;&#xFF1A;</p>
<pre><code>Parameter();  // Name is empty, type is NOT_SET
explicit Parameter(const Parameter&amp; parameter);
explicit Parameter(const std::string&amp; name);  // Type is NOT_SET
Parameter(const std::string&amp; name, const bool bool_value);
Parameter(const std::string&amp; name, const int int_value);
Parameter(const std::string&amp; name, const int64_t int_value);
Parameter(const std::string&amp; name, const float double_value);
Parameter(const std::string&amp; name, const double double_value);
Parameter(const std::string&amp; name, const std::string&amp; string_value);
Parameter(const std::string&amp; name, const char* string_value);
Parameter(const std::string&amp; name, const std::string&amp; msg_str,
          const std::string&amp; full_name, const std::string&amp; proto_desc);
Parameter(const std::string&amp; name, const google::protobuf::Message&amp; msg);
</code></pre><p>&#x6210;&#x5458;&#x51FD;&#x6570;&#xFF1A;</p>
<pre><code>inline ParamType type() const;
inline std::string TypeName() const;
inline std::string Descriptor() const;
inline const std::string Name() const;
inline bool AsBool() const;
inline int64_t AsInt64() const;
inline double AsDouble() const;
inline const std::string AsString() const;
std::string DebugString() const;
template &lt;typename Type&gt;
typename std::enable_if&lt;std::is_base_of&lt;google::protobuf::Message, Type&gt;::value, Type&gt;::type
value() const;
template &lt;typename Type&gt;
typename std::enable_if&lt;std::is_integral&lt;Type&gt;::value &amp;&amp; !std::is_same&lt;Type, bool&gt;::value, Type&gt;::type
value() const;
template &lt;typename Type&gt;
typename std::enable_if&lt;std::is_floating_point&lt;Type&gt;::value, Type&gt;::type
value() const;
template &lt;typename Type&gt;
typename std::enable_if&lt;std::is_convertible&lt;Type, std::string&gt;::value, const std::string&amp;&gt;::type
value() const;
template &lt;typename Type&gt;
typename std::enable_if&lt;std::is_same&lt;Type, bool&gt;::value, bool&gt;::type
value() const;
</code></pre><h4 id="2&#x53C2;&#x6570;&#x670D;&#x52A1;&#x7AEF;">2.&#x53C2;&#x6570;&#x670D;&#x52A1;&#x7AEF;</h4>
<h5 id="2-1&#x521B;&#x5EFA;&#x53C2;&#x6570;&#x670D;&#x52A1;&#x7AEF;">2-1.&#x521B;&#x5EFA;&#x53C2;&#x6570;&#x670D;&#x52A1;&#x7AEF;</h5>
<p>&#x6784;&#x9020;&#x51FD;&#x6570;</p>
<pre><code>explicit ParameterService(const std::shared_ptr&lt;Node&gt;&amp; node);
</code></pre><p>&#x53C2;&#x6570;&#xFF1A;</p>
<ul>
<li>node &#x8282;&#x70B9;&#x7684;&#x5171;&#x4EAB;&#x6307;&#x9488;</li>
</ul>
<h5 id="2-2&#x64CD;&#x4F5C;&#x53C2;&#x6570;">2-2.&#x64CD;&#x4F5C;&#x53C2;&#x6570;</h5>
<p><strong>&#x8BBE;&#x7F6E;&#x53C2;&#x6570;</strong></p>
<pre><code>void SetParameter(const Parameter&amp; parameter);
</code></pre><p>&#x53C2;&#x6570;&#xFF1A;</p>
<ul>
<li>&#x53C2;&#x6570;&#x5BF9;&#x8C61;</li>
</ul>
<p><strong>&#x83B7;&#x53D6;&#x67D0;&#x4E2A;&#x53C2;&#x6570;</strong></p>
<pre><code>bool GetParameter(const std::string&amp; param_name, Parameter* parameter);
</code></pre><p>&#x53C2;&#x6570;&#xFF1A;</p>
<ul>
<li>param_name &#x8981;&#x83B7;&#x53D6;&#x7684;&#x53C2;&#x6570;&#x540D;&#x79F0;</li>
<li>parameter &#x4FDD;&#x5B58;&#x53C2;&#x6570;&#x7684;&#x53C2;&#x6570;&#x5BF9;&#x8C61;&#x6307;&#x9488;</li>
</ul>
<p>&#x8FD4;&#x56DE;&#x503C;&#xFF1A;&#x83B7;&#x53D6;&#x6210;&#x529F;&#x8FD4;&#x56DE;true&#xFF0C;&#x8C03;&#x7528;&#x670D;&#x52A1;&#x5931;&#x8D25;&#x6216;&#x8D85;&#x65F6;&#x8FD4;&#x56DE;false</p>
<p><strong>&#x83B7;&#x53D6;&#x6240;&#x6709;&#x53C2;&#x6570;</strong></p>
<pre><code>bool ListParameters(std::vector&lt;Parameter&gt;* parameters);
</code></pre><p>&#x53C2;&#x6570;&#xFF1A;</p>
<ul>
<li>parameters &#x7528;&#x4E8E;&#x4FDD;&#x5B58;&#x6240;&#x83B7;&#x53D6;&#x7684;&#x6240;&#x6709;&#x53C2;&#x6570;&#x7684; vector &#x6307;&#x9488;</li>
</ul>
<p>&#x8FD4;&#x56DE;&#x503C;&#xFF1A;&#x83B7;&#x53D6;&#x6210;&#x529F;&#x8FD4;&#x56DE;true&#xFF0C;&#x8C03;&#x7528;&#x670D;&#x52A1;&#x5931;&#x8D25;&#x6216;&#x8D85;&#x65F6;&#x8FD4;&#x56DE;false</p>
<h4 id="3&#x53C2;&#x6570;&#x5BA2;&#x6237;&#x7AEF;">3.&#x53C2;&#x6570;&#x5BA2;&#x6237;&#x7AEF;</h4>
<h5 id="2-1&#x521B;&#x5EFA;&#x53C2;&#x6570;&#x670D;&#x52A1;&#x7AEF;">2-1.&#x521B;&#x5EFA;&#x53C2;&#x6570;&#x670D;&#x52A1;&#x7AEF;</h5>
<p>&#x6784;&#x9020;&#x51FD;&#x6570;</p>
<pre><code>ParameterClient(const std::shared_ptr&lt;Node&gt;&amp; node, const std::string&amp; service_node_name);
</code></pre><p>&#x53C2;&#x6570;&#xFF1A;</p>
<ul>
<li>node &#x8282;&#x70B9;&#x7684;&#x5171;&#x4EAB;&#x6307;&#x9488;</li>
<li>service_node_name &#x53C2;&#x6570;&#x670D;&#x52A1;&#x7AEF;&#x7684;&#x8282;&#x70B9;&#x540D;&#x79F0;</li>
</ul>
<h5 id="2-2&#x64CD;&#x4F5C;&#x53C2;&#x6570;">2-2.&#x64CD;&#x4F5C;&#x53C2;&#x6570;</h5>
<p><strong>&#x8BBE;&#x7F6E;&#x53C2;&#x6570;</strong></p>
<pre><code>void SetParameter(const Parameter&amp; parameter);
</code></pre><p>&#x53C2;&#x6570;&#xFF1A;</p>
<ul>
<li>&#x53C2;&#x6570;&#x5BF9;&#x8C61;</li>
</ul>
<p><strong>&#x83B7;&#x53D6;&#x67D0;&#x4E2A;&#x53C2;&#x6570;</strong></p>
<pre><code>/**
 * @brief Get the Parameter object
 *
 * @param param_name
 * @param parameter the pointer to store
 * @return true
 * @return false call service fail or timeout
 */
bool GetParameter(const std::string&amp; param_name, Parameter* parameter);
</code></pre><p>&#x53C2;&#x6570;&#xFF1A;</p>
<ul>
<li>param_name &#x8981;&#x83B7;&#x53D6;&#x7684;&#x53C2;&#x6570;&#x540D;&#x79F0;</li>
<li>parameter &#x4FDD;&#x5B58;&#x53C2;&#x6570;&#x7684;&#x53C2;&#x6570;&#x5BF9;&#x8C61;&#x6307;&#x9488;</li>
</ul>
<p>&#x8FD4;&#x56DE;&#x503C;&#xFF1A;&#x83B7;&#x53D6;&#x6210;&#x529F;&#x8FD4;&#x56DE;true&#xFF0C;&#x8C03;&#x7528;&#x670D;&#x52A1;&#x5931;&#x8D25;&#x6216;&#x8D85;&#x65F6;&#x8FD4;&#x56DE;false</p>
<p><strong>&#x83B7;&#x53D6;&#x6240;&#x6709;&#x53C2;&#x6570;</strong></p>
<pre><code>bool ListParameters(std::vector&lt;Parameter&gt;* parameters);
</code></pre><p>&#x53C2;&#x6570;&#xFF1A;</p>
<ul>
<li>parameters &#x7528;&#x4E8E;&#x4FDD;&#x5B58;&#x6240;&#x83B7;&#x53D6;&#x7684;&#x6240;&#x6709;&#x53C2;&#x6570;&#x7684; vector &#x6307;&#x9488;</li>
</ul>
<p>&#x8FD4;&#x56DE;&#x503C;&#xFF1A;&#x83B7;&#x53D6;&#x6210;&#x529F;&#x8FD4;&#x56DE;true&#xFF0C;&#x8C03;&#x7528;&#x670D;&#x52A1;&#x5931;&#x8D25;&#x6216;&#x8D85;&#x65F6;&#x8FD4;&#x56DE;false</p>
<hr>
<h3 id="python&#x90E8;&#x5206;">Python&#x90E8;&#x5206;</h3>
<h4 id="1&#x53C2;&#x6570;&#x5BF9;&#x8C61;">1.&#x53C2;&#x6570;&#x5BF9;&#x8C61;</h4>
<pre><code>class Parameter(object):

    &quot;&quot;&quot;
    Class for Parameter wrapper.
    &quot;&quot;&quot;

    def __init__(self, name, value=None)
</code></pre><pre><code>    def as_string(self):
        &quot;&quot;&quot;
        return native value
        &quot;&quot;&quot;
        return _CYBER_PARAM.PyParameter_as_string(self.param)

    def as_double(self):
        &quot;&quot;&quot;
        return native value
        &quot;&quot;&quot;
        return _CYBER_PARAM.PyParameter_as_double(self.param)

    def as_int64(self):
        &quot;&quot;&quot;
        return native value
        &quot;&quot;&quot;
        return _CYBER_PARAM.PyParameter_as_int64(self.param)
</code></pre><h4 id="2&#x53C2;&#x6570;&#x670D;&#x52A1;&#x7AEF;">2.&#x53C2;&#x6570;&#x670D;&#x52A1;&#x7AEF;</h4>
<h5 id="2-1&#x521B;&#x5EFA;&#x53C2;&#x6570;&#x670D;&#x52A1;&#x7AEF;">2-1.&#x521B;&#x5EFA;&#x53C2;&#x6570;&#x670D;&#x52A1;&#x7AEF;</h5>
<h5 id="2-2&#x64CD;&#x4F5C;&#x53C2;&#x6570;">2-2.&#x64CD;&#x4F5C;&#x53C2;&#x6570;</h5>
<pre><code>class ParameterServer(object):

    &quot;&quot;&quot;
    Class for ParameterServer wrapper.
    &quot;&quot;&quot;

    ##
    # @brief constructor the ParameterServer by the node object.
    #
    # @param node the node to support the parameter server.
    def __init__(self, node):
        self.param_srv = _CYBER_PARAM.new_PyParameterServer(node.node)

    def __del__(self):
        _CYBER_PARAM.delete_PyParameterServer(self.param_srv)

    def set_parameter(self, param):
        &quot;&quot;&quot;
        set parameter, param is Parameter.
        &quot;&quot;&quot;
        return _CYBER_PARAM.PyParameter_srv_set_parameter(self.param_srv, param.param)

    def get_parameter(self, param_name):
        &quot;&quot;&quot;
        get Parameter by param name param_name.
        &quot;&quot;&quot;
        return Parameter(_CYBER_PARAM.PyParameter_srv_get_parameter(self.param_srv, param_name))

    def get_paramslist(self):
        &quot;&quot;&quot;
        get all params of this parameterserver.
        &quot;&quot;&quot;
        pycapsulelist = _CYBER_PARAM.PyParameter_srv_get_parameter_list(
            self.param_srv)
        param_list = []
        for capsuleobj in pycapsulelist:
            param_list.append(Parameter(capsuleobj))
        return param_list
</code></pre><h4 id="3&#x53C2;&#x6570;&#x5BA2;&#x6237;&#x7AEF;">3.&#x53C2;&#x6570;&#x5BA2;&#x6237;&#x7AEF;</h4>
<pre><code>class ParameterClient(object):

    &quot;&quot;&quot;
    Class for ParameterClient wrapper.
    &quot;&quot;&quot;

    ##
    # @brief constructor the ParameterClient by a node and the parameter server node name.
    #
    # @param node a node to create client.
    # @param server_node_name the parameter server&apos;s node name.
    def __init__(self, node, server_node_name):
        self.param_clt = _CYBER_PARAM.new_PyParameterClient(
            node.node, server_node_name)

    def __del__(self):
        _CYBER_PARAM.delete_PyParameterClient(self.param_clt)

    def set_parameter(self, param):
        &quot;&quot;&quot;
        set parameter, param is Parameter.
        &quot;&quot;&quot;
        return _CYBER_PARAM.PyParameter_clt_set_parameter(self.param_clt, param.param)

    def get_parameter(self, param_name):
        &quot;&quot;&quot;
        get Parameter by param name param_name.
        &quot;&quot;&quot;
        return Parameter(_CYBER_PARAM.PyParameter_clt_get_parameter(self.param_clt, param_name))

    def get_paramslist(self):
        &quot;&quot;&quot;
        get all params of the server_node_name parameterserver.
        &quot;&quot;&quot;
        pycapsulelist = _CYBER_PARAM.PyParameter_clt_get_parameter_list(
            self.param_clt)
        param_list = []
        for capsuleobj in pycapsulelist:
            param_list.append(Parameter(capsuleobj))
        return param_list
</code></pre>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="3ding-shi-qi-xiang-guan-api.html" class="navigation navigation-prev " aria-label="Previous page: 4.3 服务相关API">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="45-zu-jian-xiang-guan-api.html" class="navigation navigation-next " aria-label="Next page: 4.5 组件相关API">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"4.4 参数相关API","level":"1.5.4","depth":2,"next":{"title":"4.5 组件相关API","level":"1.5.5","depth":2,"path":"zi-65993a-chang-yong-api/45-zu-jian-xiang-guan-api.md","ref":"zi-65993a-chang-yong-api/45-zu-jian-xiang-guan-api.md","articles":[]},"previous":{"title":"4.3 服务相关API","level":"1.5.3","depth":2,"path":"zi-65993a-chang-yong-api/3ding-shi-qi-xiang-guan-api.md","ref":"zi-65993a-chang-yong-api/3ding-shi-qi-xiang-guan-api.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["expandable-chapters"],"pluginsConfig":{"expandable-chapters":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"zi-65993a-chang-yong-api/44-can-shu-xiang-guan-api.md","mtime":"2022-04-04T17:00:12.284Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2022-04-10T10:28:55.066Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

